
// 参考地址： https://juejin.cn/post/7314571744353681460?searchId=202406150000259F975F5D209318CD1D00
Function.prototype.newBind = function (context, ...bindArgs) {
    console.log('🚀 ~ This is a result of console.log ~ ✨bind: ', bindArgs);
      const self = this; // 当前调用bind的函数对象
        console.log('self :>> ', self);
      // 返回的函数本身也是可以再传入参数的
      return function (...args) {
        console.log('🚀 ~ This is a result of console.log ~ ✨:arge ', args);
      // 拼接参数
       const newArgs = bindArgs.concat(args);
        return self.apply(context, newArgs)
      }
   }
   function fn(a,b, c) {
       console.log('🚀 ~ This is a result of console.log ~ ✨:argu ',arguments);
       console.log(this, a, b, c);
   }
   const fn1 = fn.newBind({x: 100}, 10, 30);
   fn1(20); 


Function.prototype.myBind = function (context, ...callArgs) {
    const self = this; // 当前调用的对象，是一个函数

    return function (...args) {  // 返回一新的函数， 也可以传如参数
        const newArgs = callArgs.concat(args);
        return self.apply(context, newArgs);
    }
}


function myInstaceOf (context, Obj) {
    let proto = context.__proto__;
    
    while (proto) {
        if (proto === Obj.prototype) {
            return true
        }
        proto = proto.__proto__
    }
    return false
}
